#ifndef _IN_COMMON_H_
#define _IN_COMMON_H_

#include <sys/prctl.h>
#include "InComPrint.h"
#include "InComConf.h"
#include "InComFileDef.h"
#include "InComFlagDef.h"
#include "InComWavDef.h"
#include "InComDataTypeDef.h"
#include "InComFileOperation.h"
#include "InComTimer.h"
#include "InComStringHandling.h"

#ifdef __cplusplus
extern "C" {
#endif

/*thread show name*/
#define DEF_COM_SET_THREAD_NAME(name,num) \
{ \
    prctl(PR_SET_NAME, (unsigned long)name); \
    num++; \
} \

#define DEF_COM_EXIT_THREAD(num) \
{ \
    if(num > 0) \
    { \
        num--; \
    } \
    PRT_NORMAL("------->%s exit\n",__func__); \
    pthread_exit(0); \
} \

/* flag value */
#define DEF_COM_TRUE                            1
#define DEF_COM_FALSE                           0

#define DEF_COM_SUCCESS                         0
#define DEF_COM_FAILED                          (-1)

#define DEF_COM_FILE_EXIST                      0
#define DEF_COM_FILE_NOT_EXIST                  (-1)

#define DEF_COM_LEVEL_HIGHT                     1
#define DEF_COM_LEVEL_LOW                       0

#define DEF_COM_ENABLE                          1
#define DEF_COM_DISABLE                         0

#define DEF_MAX_P2P_USER_NUM                    5
#define DEF_SAVE_PCM_TIME                       10

#define DEF_SNAP_PIC_MAX_SIZE                   (100 * 1024)

#define DEF_COM_WLAN_DEV                        "wlan0"
#define DEF_COM_SAVE_JEP_PATH                   "/tmp/tmpfs"
#define DEF_WPA_CONF_PATH                       "/tmp/wpa_conf"
#define DEF_WEP_CONF_PATH                       "/tmp/wep_conf"
#define DEF_OPEN_CONF_PATH                      "/tmp/open_conf"

#define DEF_COM_JPEG_NAME                       "motion_detect.jpg"

#define ComNullRetInt(data) \
{ \
    if(data == NULL) { \
        PRT_ERR("Int","%s,line: %d, NULL\n",__func__,__LINE__); \
        return -1; \
    } \
}

#define ComNullRetVoid(data) \
{ \
    if(data == NULL) { \
        PRT_ERR("Void","%s,line: %d, NULL\n",__func__,__LINE__); \
        return; \
    } \
}

typedef enum
{
    MODE_BASE_16 = 0,
    MODE_BASE_10,
}EComDataModeBase;

typedef enum
{
    MD_LOW_SENSITIVITY = 0,
    MD_MID_SENSITIVITY,
    MD_HIGH_SENSITIVITY,
}EMotionDetectSensitivity;

#if CMAKE_NONSUPPORT_GET_YUV && CMAKE_SUPPORT_QRCODE
extern Com_s8 g_ComVideo_SubBuff_Flag;
#endif

extern Com_u8 g_ComThread_Running;
extern Com_u32 g_ComThread_Num;

#ifdef __cplusplus
}
#endif

#endif
